package com.zline.foodraise.baidu;

import android.location.Location;

import com.baidu.mapapi.model.LatLng;
import com.baidu.mapapi.search.poi.OnGetPoiSearchResultListener;
import com.baidu.mapapi.search.poi.PoiCitySearchOption;
import com.baidu.mapapi.search.poi.PoiNearbySearchOption;
import com.baidu.mapapi.search.poi.PoiSearch;
import com.zline.foodraise.util.LUtil;

import org.androidannotations.annotations.EBean;

/**
 * Created by heshantao on 15/7/5.
 * 百度POI 检索
 */
@EBean
public class PoiSearchUtil {
    private static final String LOG_TAG=PoiSearchUtil.class.getSimpleName();
    PoiSearch poiSearch;
    OnGetPoiSearchResultListener listener;

    public void setPoiSearchListener( OnGetPoiSearchResultListener listener){
        this.listener=listener;
    }

    //发起Poi请求
    public void requestPoi(String city,String key,int number) {
        poiSearch = PoiSearch.newInstance();
        poiSearch.setOnGetPoiSearchResultListener(listener);
        poiSearch.searchInCity((new PoiCitySearchOption())
                .city(city)
                .keyword(key)
                .pageCapacity(number));

    }

    public void  destory(){
        if(poiSearch!=null){
            poiSearch.destroy();
        }
    }

}
